package com.yiwyn.ood.isp;

public class ISPGoodDemo {


    public static void main(String[] args) {
        // 麻雀
        Fly sparrow = new Sparrow();
        sparrow.fly();

        // 鸵鸟
        Run ostrich = new Ostrich();
        ostrich.run();
    }

    /**
     * 鸟类接口
     */
    interface Bird {
        // 吃
        void eat();
    }

    /**
     * 会飞的
     */
    interface Fly {
        // 飞
        void fly();
    }

    /**
     * 会跑的
     */
    interface Run {
        // 跑
        void run();
    }


    /**
     * 麻雀
     */
    static class Sparrow implements Bird, Fly {

        @Override
        public void fly() {
            System.out.println("I'm flying");
        }

        @Override
        public void eat() {
            System.out.println("I'm eating");
        }
    }


    static class Ostrich implements Bird, Run {

        @Override
        public void run() {
            System.out.println("I'm run");
        }

        @Override
        public void eat() {
            System.out.println("I'm eating");
        }
    }


}
